package com.example.sptest;

import android.app.Activity;
import android.content.Intent;
import android.content.SharedPreferences;
import android.os.Bundle;
import android.preference.EditTextPreference;
import android.preference.PreferenceActivity;
import android.preference.PreferenceManager;
import android.util.Log;
import android.view.View;

public class MainActivity extends Activity {

	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.activity_main);
	}

	public void onClick(View v){
		switch (v.getId()) {
		case R.id.button1:
			Intent intent = new Intent(MainActivity.this,Setting.class);
			startActivity(intent);
			break;

		case R.id.button2:
			SharedPreferences sp = PreferenceManager.getDefaultSharedPreferences(this);
			boolean ON_OFF = sp.getBoolean("checkbox_preference", false);
			boolean next_screen = sp.getBoolean("next_screen_checkbox_preference", false);
			String text = sp.getString("edittext_preference", "");
			String listtext = sp.getString("list_preference", "");
			Log.i("lenve", ON_OFF+"--"+next_screen+"--"+text+"--"+listtext);
			break;
		default:
			break;
		}
	}
}
